﻿#include "mTestButton1.h"
#include <QDebug>
#include <QString>
#include <QChar>
#include "stable.h"




mTestButton1::mTestButton1(QWidget *parent)
    : QPushButton(parent)
{
//    qDebug()<<"我的类构造调用";
    this->move(100,100);
}



mTestButton1::~mTestButton1()
{
//    qDebug()<<"我的类析构调用";
}



void mTestButton1::ChangeButtonText()
{
    //---练习随机数
    int     nTempNumber = qrand()%100;
    QString str(tr("change button text"));
    str +=  QString::number(nTempNumber,10);


    //---练习格式化字符串
    str = QString(tr("change button text:%1")).arg(nTempNumber,4,10,QChar('_'));


    this->setText(str);
}



void mTestButton1::ChangeButtonText2()
{
    int     nTempNumber = qrand()%20;
    QString str(tr("change button text"));
    str = QString(tr("change button text:%1")).arg(nTempNumber,4,16,QChar('.'));


    this->setText(str);
}
